home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / awe2-0_1.lha / awe2-0.1 / Src / CpuMuxExceptions.cc < prev    next >
C/C++ Source or Header  |  1990-07-09  |  1KB  |  52 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. // 
  3. // Copyright (C) 1988 University of Illinois, Urbana, Illinois
  4. // Copyright (C) 1989 University of Colorado, Boulder, Colorado
  5. // Copyright (C) 1990 University of Colorado, Boulder, Colorado
  6. //
  7. // written by Dirk Grunwald (grunwald@foobar.colorado.edu)
  8. //
  9. #include "CpuMuxExceptions.h"
  10. #include "ReserveByException.h"
  11. #include "CpuMultiplexor.h"
  12. #include "SpinBarrier.h"
  13. #include "stream.h"
  14. #include "Thread.h"
  15.  
  16. void
  17. ExceptionReserve::handleException()
  18. {
  19.     if ( toReserve -> reserveByException( ThisCpu -> currentThread ) ) {
  20.     ThisCpu -> currentThread = 0;
  21.     }
  22. }
  23.  
  24. void
  25. ExceptionTerminate::handleException()
  26. {
  27.     ThisCpu -> currentThread = 0; // do before delete so thread frees stack
  28.     delete deadThread;
  29. }
  30.  
  31. void
  32. ExceptionReschedule::handleException()
  33. {
  34.     //
  35.     // Switch to another thread when we havenot gotten
  36.     // rid of the current one.
  37.     //
  38.     assert(ThisCpu -> currentThread != 0);
  39.     ThisCpu -> add( ThisCpu -> currentThread );
  40.     ThisCpu -> currentThread = 0;
  41. }
  42.  
  43. void
  44. ExceptionIveSuspended::handleException()
  45. {
  46.     //
  47.     // Switch to another thread when we havenot gotten
  48.     // rid of the current one.
  49.     //
  50.     ThisCpu -> currentThread = 0;
  51. }
  52.